package com.swanclouds.redfish.systems.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.swanclouds.model.Device;
import com.swanclouds.redfish.common.redfish.MemberModel;

/**
 * @author 张立强
 * @version jdk1.8.0
 */
public class NetworkInterface extends Device {

    @JsonProperty("NetworkPorts")
    private MemberModel networkPorts;

    public String getNetworkPorts() {
        return this.networkPorts != null ? this.networkPorts.getDataId() : null;
    }

    @Override
    public String toString() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
        }
        return "NetworkInterface {" +
                "networkPorts=" + networkPorts +
                '}';
    }
}
